<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>商品管理</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/backStyle.css">
<link rel="stylesheet" type="text/css" href="css/myButton.css">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap-modal.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>

<style>
html,body {
	height: 100%;
	width: 100%;
	border: 0;
	background: #fff;
	overflow-y: auto;
}
</style>
</head>

<body>
	<ul class="breadcrumb">
		<li><a href="sys/welcome.jsp">首页</a></li>
		<li class="active">商品管理</li>
	</ul>
	<div class="panel panel-default">
		<div class="panel-body">
			<table class="table table-striped">
				<thead>
					<tr>
						<th style="width: 10%;">商品图片</th>
						<th style="width: 35%;">商品名</th>
						<th style="width: 10%;">售价</th>
						<th style="width: 15%;">卖家</th>
						<th style="width: 10%;">是否在售</th>
						<th style="width: 20%;">操作</th>
					</tr>
				</thead>
				<tbody id="goodsTable">
					<s:iterator value="Glist" var="goods">
						<tr>
							<td>
								<s:if test="#goods.img==null||#goods.img==''">
								<img alt="商品图片未能正确加载" src="./images/pic1.jpg" width="80px">
								</s:if><s:else>
								<img alt="商品图片未能正确加载" src="<s:property value="#goods.img"/>" width="80px">
								</s:else>
							</td>
							<td><s:property value="#goods.goodsname"/></td>
							<td><s:property value="#goods.price"/></td>
							<td><s:property value="#goods.user.name"/></td>
							<td>
								<s:if test="#goods.isDelete == 0">在售</s:if>
								<s:if test="#goods.isDelete == 1">下架</s:if>
							</td>
							<td><a class="button blue medium" onclick="viewGoods('<s:property value="#goods.id"/>')">查看</a></td>
						</tr>
					</s:iterator>
				</tbody>
			</table>
		</div>
	</div>
</body>
<script type="text/javascript">
		function viewGoods(id){
			window.location.href = "<%=basePath%>goodsView.action?goods.id="+id;
		}
	</script>
</html>